<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <input type="text" id="txt">
    <ul class="list"></ul>
</body>
<script src="./jsonp.js"></script>
<script>
    const otxt = document.getElementById("txt")
    const olist = document.querySelector(".list")

    otxt.oninput = function(){
        jsonp("https://suggest.taobao.com/sug", {
            k:1,
            area:"c2c",
            q:this.value,
            code:"utf-8",
            ts:"1663317399744",
            callback:"ahsjdgvsugeubirtfl",
            cbNameFieldName:"callback"
        }, res=>{
            // console.log(res.result);
            let str = "";
            res.result.forEach(val=>{
                str += `<li>${val[0]}</li>`
            })
            olist.innerHTML = str;
        })
    }

</script>
</html>